package com.xxx.kjds.controller;

import com.xxx.kjds.entity.Storehouse;
import com.xxx.kjds.service.StorehouseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/storehouse")
public class StorehouseController {
    @Autowired
    private StorehouseService storehouseService;


    @RequestMapping("/selectStoreByPrimaryKey")
    public Storehouse selectStoreByPrimaryKey(Integer id){
        return storehouseService.selectByPrimaryKey(id);
    }


    @PostMapping("/addStorehouse")
    @ResponseBody
    public String addStorehouse(Integer id , String name , Integer movId){
        Storehouse storehouse = new Storehouse(id , name , movId);
        int re = storehouseService.insert(storehouse);
        if(re == 1) return "添加仓库成功";
        return "添加仓库失败";
    }

}
